Skip to content

Decide where the name starts once, for title-particle heads (#624) - #633

Merged
derek73 merged 3 commits into
masterfrom
fix/issue-624-name-start
Oct 11, 2026
Merged

derek73 merged 3 commits into
masterfrom
fix/issue-624-name-start

Conversation

@derek73

@derek73 derek73 commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

freiherr and st are both titles and particles (TITLES ∩ particles_ambiguous). Such a word in the leading titles is the particle chain's leading position (rules.md#P4), so the particle behind it is inside a name (Freiherr von Berg → family 'von Berg'). Three places each decided where the name starts, and they disagreed when two such words stood together:

Input Before Now
Dr. St John Smith title 'Dr. St', given 'John', family 'Smith' same
Freiherr St John Smith MA title 'Freiherr', family 'St John Smith', plus a title-or-name report saying "read as a family name by convention" title 'Freiherr St', given 'John', family 'Smith', suffix 'MA'
Freiherr St van Berg MA title 'Freiherr', family 'St van Berg' title 'Freiherr St', family 'van Berg' (as Dr. St van Johnson)
Freiherr von Berg title 'Freiherr', family 'von Berg' same

Decided by Derek: consistency and one shared answer, no special case for garbage.

  • One answer: _pieces.chain_lead gives the leading position once. It's the last title in assign's own title run that is also a particle, else the first piece past the run. Group's chain and _chain_units both take it.
  • Titles as written: the run is read before H3's give-back. A title handed back to the name because only suffix words follow it is still a title to the chain, so the particle behind it leads and chains nothing (P4). leading_titles stops at a leading title only where it gave that piece back, so chain_lead recognises the give-back from n alone, behind the same inline tag test.
  • Less machinery: no particle stands between the lead and the run's end, so the chain opens no unit inside the titles. _chain_units loses its at answer and its q > k + 1 gate, and group's chain drops its own scan.
  • Group's chain skip: it now skips every piece up to the lead (k <= leading). That's equivalent to the old k == leading wherever the lead was the first title-particle.

Not done: the issue also proposed retiring assign's re-read fallback. Measured, it still does real work: disabled, sixteen or seventeen more tests fail (depending on how it's disabled), most of them crashing with an IndexError. So it guards totality, not just a reading. Among them is a_title_read_before_the_chain_can_strand_the_name (Freiherr von Berg Dr. and Ed. Prof., a connective join that makes the name a title). It stays.

Measured (decisions.md#P2, 2026-10-10)

Against master 8e6e524, py3.11, nameparser.__file__ asserted on each side:

  • Title-particle head grid: every 1–4 word sequence over Freiherr St Dr. Sir Xyz. von van de do Mc John Smith MA PhD VI Prof. née Jr. and, plus comma forms. That's 137,810 names under three orders. Result: 5,964 role moves, and none in report text only.
    • 5,868 have two title-particles in the leading title run, now all titles. Where H3 then gives the last one back, the word behind it is the post-nominal H3 saw (Dr. Freiherr St Mc → family 'St', suffix 'Mc'; master family 'St Mc').
    • 96 are H3's give-back before dual particles, read as H3 states (Dr. Mc Mc → given 'Dr.', suffix 'Mc Mc'). Master gave given 'Dr.', middle 'Mc', family 'Mc', because the read counted the second 'Mc' as bound into a run the chain never built.
  • Comma-tail grid (97,650 texts, recipe in the entry): 1,368 parses on 456 texts move. Every one is a part past the second comma led by two title-particles, now all titles as C2 reads them (,, Freiherr Freiherr Bart → title 'Freiherr Freiherr', suffix 'Bart').
  • S2 stress grid (Rethink the credential-run rule (S2): read a name's trailing run once, over name units, and bind it before any join #614's recipe, 324,552 parses): 0 moves.
  • Corpus names and case texts: only the case rows rewritten here move.
  • Five differential gates: all exit 0, with the new rules.md example explained by a fix(#624) rule in each ledger.
  • Frames: every baseline moves down by 4. parse 308 → 304 on 3.11 and 289 → 285 on 3.12–3.15; facade 345 → 341 and 326 → 322. Re-recorded in _CALL_BASELINE and decisions.md#parse-cost.

Tests

  • Five case rows pinned the old decision and now read the new one (fix(#624), each note giving the earlier reading): Freiherr St van Berg MA, Freiherr Freiherr Prof do, St St VI, Freiherr St MA, Freiherr St Prof..
  • New rows: Freiherr St John Smith MA, the issue's example, and Dr. Mc Mc, which pins the give-back half.
  • Moved row: the one holding group's particle-or-given emitter goes from St St née to St van née (parity). It's the same structure with a chained particle that is not a title, since St St née no longer reaches that emitter.
  • test_pieces.py: _chain_units returns units only. test_the_chain_opens_no_unit_inside_the_titles replaces the test of the old design.
  • The field sweep checks 1149 claims (was 1158): the rewritten rows lost their wrong title-or-name reports, and Dr. Mc Mc adds three. Its control was re-measured against 26cdb89 over today's rows: still 14 failures, with Freiherr St John Smith MA in place of St St née.

Docs

Review

Closes #624

🤖 Generated with Claude Code

`freiherr` and `st` are both titles and particles, and such a word in
the leading titles is the particle chain's leading position (P4), so
the particle behind it is inside a name ('Freiherr von Berg'). Group's
chain found that position with a scan of its own that stopped at the
first such word and chained the second, while assign read both as
titles and the trailing read's unit count opened a unit inside the
titles to follow: 'Freiherr St John Smith MA' read family
'St John Smith' where 'Dr. St John Smith' reads title 'Dr. St', given
'John', family 'Smith'.

`_pieces.chain_lead` now gives the leading position once -- the last
title in assign's own title run that is also a particle, else the
first piece past it -- and group's chain and `_chain_units` both take
it. No unit opens inside the titles, so `_chain_units` loses its `at`
answer and its `q > k + 1` gate. Assign's re-read fallback stays: it
serves a connective join that makes the name a title, which this does
not touch.

Measured against 8e6e524: a title-particle head grid (137,810 names,
three orders) moves 5,785 parses, all two title-particles in the
leading run or H3's give-back before dual particles; the S2 grid moves
none; only the six case rows rewritten here move among corpus names
and case texts; the five gates exit 0. Every frame baseline moves down
by 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 2.4 milestone Oct 10, 2026
@derek73 derek73 added the bug label Oct 10, 2026
@derek73 derek73 self-assigned this Oct 10, 2026
@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.01%. Comparing base (8e6e524) to head (12ef837).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #633      +/-   ##
==========================================
- Coverage   99.01%   99.01%   -0.01%     
==========================================
  Files          46       46              
  Lines        4488     4487       -1     
==========================================
- Hits         4444     4443       -1     
  Misses         44       44              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

derek73 and others added 2 commits October 10, 2026 17:11
- chain_lead reads assign's title run before H3's give-back (Derek, the
  review's option (a)): a title handed back to the name because only
  suffix words follow it is still a title to the chain, so the particle
  behind it leads and chains nothing (P4). The first draft read the
  give-back as the lead, so `Dr. Mc Mc` chained its leading particle
  behind a plain title (title 'Dr.', family 'Mc Mc'), and a caller
  lexicon could make the group emitter fire behind one. It now reads as
  H3 states: given 'Dr.', suffix 'Mc Mc'. New row pins it.
- rules.md: P4's clause says the LAST title-particle, limits itself to
  the leading titles and names the give-back (interacts gains H3); H4's
  Accepted example moves from `St St née` to `St van Bishop`.
- decisions.md: the #624 entry records option (a), the first draft's
  readings, a comma-tail grid the first measurement missed (1,368
  parses, all two title-particles past the second comma, now titles as
  C2 reads them), and the fallback guarding totality; the #614 and #620
  entries point at #624 where they describe the removed mechanism.
- Stale comments in _group.py, _pieces.py and test_group.py; the field
  sweep's control docstring names the right substitute row; the count
  moves 1146 -> 1149 (the new row), the control re-measured at 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- chain_lead's docstring and the decisions.md #624 entry: leading_titles
  also stops at a segment's last piece, which the `n + 1 < len(pieces)`
  test rules out; P4 says each title-particle reads as a title unless
  H3 gives it back.
- The five ledgers' fix(#624) comments quoted P4's first-draft wording,
  which 07957c5 replaced; they now quote the current text. The excerpt
  check still scans only .py files (the follow-up task filed on #631).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 merged commit 6185e6f into master Oct 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Where does Freiherr St John Smith MA start: should a title that is also a particle open the name?

1 participant